using System;

namespace Sustainalytics.ESGRatings.BusinessLogic.Computing
{
    internal class EsgSetGuidIntIdPair
    {
        private readonly Tuple<Guid, int> _internalTupe;

        public EsgSetGuidIntIdPair(Guid guid, int id)
        {
            _internalTupe = new Tuple<Guid, int>(guid, id);
        }

        public int CudaId
        {
            get { return _internalTupe.Item2; }
        }

        public Guid SetId
        {
            get { return _internalTupe.Item1; }
        }

        protected bool Equals(EsgSetGuidIntIdPair other)
        {
            return Equals(SetId, other.SetId) && Equals(CudaId, other.CudaId);
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj))
            {
                return false;
            }
            if (ReferenceEquals(this, obj))
            {
                return true;
            }
            if (obj.GetType() != GetType())
            {
                return false;
            }
            return Equals((EsgSetGuidIntIdPair) obj);
        }

        public override int GetHashCode()
        {
            return (_internalTupe != null ? _internalTupe.GetHashCode() : 0);
        }
    }
}